#include <xen/smp.h>
#include <xen/trace.h>
#include <xen/errno.h>
+#include <xen/event.h>
+#include <xen/softirq.h>
#include <xen/init.h>
#include <asm/atomic.h>
#include <public/dom0_ops.h>
static struct t_rec *t_recs[NR_CPUS];
static int nr_recs;
+/* High water mark for trace buffers; */
+/* Send virtual interrupt when buffer level reaches this point */
+static int t_buf_highwater;
+
+
/* a flag recording whether initialization has been done */
/* or more properly, if the tbuf subsystem is enabled right now */
int tb_init_done;
/* which tracing events are enabled */
static u32 tb_event_mask = TRC_ALL;
+static void trace_notify_guest(void)
+{
+ send_guest_global_virq(dom0, VIRQ_TBUF);
+}
+
+
/**
* alloc_trace_bufs - performs initialization of the per-cpu trace buffers.
*
t_recs[i] = (struct t_rec *)(buf + 1);
}
+ t_buf_highwater = nr_recs >> 1; /* 50% high water */
+ open_softirq(TRACE_SOFTIRQ, trace_notify_guest);
+
return 0;
}
buf->prod++;
local_irq_restore(flags);
+
+ /*
+ * Notify trace buffer consumer that we've reached the high water mark.
+ *
+ */
+ if ( (buf->prod - buf->cons) == t_buf_highwater )
+ raise_softirq(TRACE_SOFTIRQ);
}
/*
#define VIRQ_DEBUG 1 /* V. Request guest to dump debug info. */
#define VIRQ_CONSOLE 2 /* G. (DOM0) Bytes received on emergency console. */
#define VIRQ_DOM_EXC 3 /* G. (DOM0) Exceptional event for some domain. */
+#define VIRQ_TBUF 4 /* G. (DOM0) Trace buffer has records available. */
#define VIRQ_DEBUGGER 6 /* G. (DOM0) A domain has paused for debugging. */
#define VIRQ_XENOPROF 7 /* V. XenOprofile interrupt: new sample available */
#define NR_VIRQS 8